﻿//MooTools More, <http://mootools.net/more>. Copyright (c) 2006-2009 Aaron Newton <http://clientcide.com/>, Valerio Proietti <http://mad4milk.net> & the MooTools team <http://mootools.net/developers>, MIT Style License.

/*
---

script: More.js

name: More

description: MooTools More

license: MIT-style license

requires:
- Core/MooTools

provides: [MooTools.More]

...
*/

MooTools.More = {
    'version': '1.2.5.1',
    'build': '254884f2b83651bf95260eed5c6cceb838e22d8e'
};


/*
---

script: MooTools.Lang.js

name: MooTools.Lang

description: Provides methods for localization.

license: MIT-style license

authors:
- Aaron Newton

requires:
- Core/Events
- /MooTools.More

provides: [Lang]

...
*/

(function () {

    var data = {
        language: 'en-US',
        languages: {
            'en-US': {}
        },
        cascades: ['en-US']
    };

    var cascaded;

    MooTools.lang = new Events();

    $extend(MooTools.lang, {

        setLanguage: function (lang) {
            if (!data.languages[lang]) return this;
            data.language = lang;
            this.load();
            this.fireEvent('langChange', lang);
            return this;
        },

        load: function () {
            var langs = this.cascade(this.getCurrentLanguage());
            cascaded = {};
            $each(langs, function (set, setName) {
                cascaded[setName] = this.lambda(set);
            }, this);
        },

        getCurrentLanguage: function () {
            return data.language;
        },

        addLanguage: function (lang) {
            data.languages[lang] = data.languages[lang] || {};
            return this;
        },

        cascade: function (lang) {
            var cascades = (data.languages[lang] || {}).cascades || [];
            cascades.combine(data.cascades);
            cascades.erase(lang).push(lang);
            var langs = cascades.map(function (lng) {
                return data.languages[lng];
            }, this);
            return $merge.apply(this, langs);
        },

        lambda: function (set) {
            (set || {}).get = function (key, args) {
                return $lambda(set[key]).apply(this, $splat(args));
            };
            return set;
        },

        get: function (set, key, args) {
            if (cascaded && cascaded[set]) return (key ? cascaded[set].get(key, args) : cascaded[set]);
        },

        set: function (lang, set, members) {
            this.addLanguage(lang);
            langData = data.languages[lang];
            if (!langData[set]) langData[set] = {};
            $extend(langData[set], members);
            if (lang == this.getCurrentLanguage()) {
                this.load();
                this.fireEvent('langChange', lang);
            }
            return this;
        },

        list: function () {
            return Hash.getKeys(data.languages);
        }

    });

})();


/*
---

script: Scroller.js

name: Scroller

description: Class which scrolls the contents of any Element (including the window) when the mouse reaches the Element's boundaries.

license: MIT-style license

authors:
- Valerio Proietti

requires:
- Core/Events
- Core/Options
- Core/Element.Event
- Core/Element.Dimensions

provides: [Scroller]

...
*/

var Scroller = new Class({

    Implements: [Events, Options],

    options: {
        area: 20,
        velocity: 1,
        onChange: function (x, y) {
            this.element.scrollTo(x, y);
        },
        fps: 50
    },

    initialize: function (element, options) {
        this.setOptions(options);
        this.element = document.id(element);
        this.docBody = document.id(this.element.getDocument().body);
        this.listener = ($type(this.element) != 'element') ? this.docBody : this.element;
        this.timer = null;
        this.bound = {
            attach: this.attach.bind(this),
            detach: this.detach.bind(this),
            getCoords: this.getCoords.bind(this)
        };
    },

    start: function () {
        this.listener.addEvents({
            mouseenter: this.bound.attach,
            mouseleave: this.bound.detach
        });
    },

    stop: function () {
        this.listener.removeEvents({
            mouseenter: this.bound.attach,
            mouseleave: this.bound.detach
        });
        this.detach();
        this.timer = $clear(this.timer);
    },

    attach: function () {
        this.listener.addEvent('mousemove', this.bound.getCoords);
    },

    detach: function () {
        this.listener.removeEvent('mousemove', this.bound.getCoords);
        this.timer = $clear(this.timer);
    },

    getCoords: function (event) {
        this.page = (this.listener.get('tag') == 'body') ? event.client : event.page;
        if (!this.timer) this.timer = this.scroll.periodical(Math.round(1000 / this.options.fps), this);
    },

    scroll: function () {
        var size = this.element.getSize(),
			scroll = this.element.getScroll(),
			pos = this.element != this.docBody ? this.element.getOffsets() : { x: 0, y: 0 },
			scrollSize = this.element.getScrollSize(),
			change = { x: 0, y: 0 },
			top = this.options.area.top || this.options.area,
		  bottom = this.options.area.bottom || this.options.area;
        for (var z in this.page) {
            if (this.page[z] < (top + pos[z]) && scroll[z] != 0) {
                change[z] = (this.page[z] - top - pos[z]) * this.options.velocity;
            } else if (this.page[z] + bottom > (size[z] + pos[z]) && scroll[z] + size[z] != scrollSize[z]) {
                change[z] = (this.page[z] - size[z] + bottom - pos[z]) * this.options.velocity;
            }
            change[z] = change[z].round();
        }
        if (change.y || change.x) this.fireEvent('change', [scroll.x + change.x, scroll.y + change.y]);
    }

});


/*
---

script: Date.Polish.js

name: Date.Polish

description: Date messages for Polish.

license: MIT-style license

authors:
- Oskar Krawczyk

requires:
- /Lang

provides: [Date.Polish]

...
*/

MooTools.lang.set('pl-PL', 'Date', {

    months: ['Styczeń', 'Luty', 'Marzec', 'Kwiecień', 'Maj', 'Czerwiec', 'Lipiec', 'Sierpień', 'Wrzesień', 'Październik', 'Listopad', 'Grudzień'],
    days: ['Niedziela', 'Poniedziałek', 'Wtorek', 'Środa', 'Czwartek', 'Piątek', 'Sobota'],

    // Culture's date order: YYYY-MM-DD
    dateOrder: ['year', 'month', 'date'],
    shortDate: '%Y-%m-%d',
    shortTime: '%H:%M',
    AM: 'nad ranem',
    PM: 'po południu',

    // Date.Extras
    ordinal: function (dayOfMonth) {
        return (dayOfMonth > 3 && dayOfMonth < 21) ? 'ty' : ['ty', 'szy', 'gi', 'ci', 'ty'][Math.min(dayOfMonth % 10, 4)];
    },

    lessThanMinuteAgo: 'mniej niż minute temu',
    minuteAgo: 'około minutę temu',
    minutesAgo: '{delta} minut temu',
    hourAgo: 'około godzinę temu',
    hoursAgo: 'około {delta} godzin temu',
    dayAgo: 'Wczoraj',
    daysAgo: '{delta} dni temu',

    lessThanMinuteUntil: 'za niecałą minutę',
    minuteUntil: 'za około minutę',
    minutesUntil: 'za {delta} minut',
    hourUntil: 'za około godzinę',
    hoursUntil: 'za około {delta} godzin',
    dayUntil: 'za 1 dzień',
    daysUntil: 'za {delta} dni'

});
